package com.lujianfei.filesend.ui.dialog

import android.content.Context
import android.content.DialogInterface
import androidx.appcompat.app.AlertDialog


/**
 * Author: lujianfei
 * Date: 2023/10/17 17:40
 * Description: 弹出对话框管理
 */

object DialogUtils {

    fun show(context: Context, title:String = "提示", content:String, confirm:DialogButton, cancel:DialogButton) {
        AlertDialog.Builder(context).setTitle(title).setMessage(content).setPositiveButton(confirm.text
        ) { dialog, which -> confirm.onClickListener?.invoke() }.setNegativeButton(cancel.text
        ) { dialog, which -> cancel.onClickListener?.invoke() }.show()
    }
}

data class DialogButton(val text:String, val onClickListener:(()->Unit)?= null)